//
//  ChongzhiViewController.m
//  specialine
//
//  Created by 往返网络 on 17/7/15.
//  Copyright © 2017年 com. All rights reserved.
//

#import "ChongzhiViewController.h"
#import "ZhifuPass1ViewController.h" //发送验证码
#import "QuerenChongzhiViewController.h"
#import "PublicMethod.h"
#define return_tag 2000
#define jine_tag   2001
#define next_tag   2002
#define cancel_tag 2003
#define forget_tag 2004
#define kDotSize CGSizeMake (10, 10) //密码点的大小
#define kDotCount 6  //密码个数
#define K_Field_Height 110.0/H_BASE*SCREEN_H  //每一个输入框的高度
//定义查询银行卡URL
#define URL_CHECKBANK [NSString stringWithFormat:@"%@/Appcustomernewer/Pay/payMyCard?type=get",BASE_URL]
//定义下一步URL
#define URL_NEXT [NSString stringWithFormat:@"%@/Appcustomernewer/Pay/toPayRechargeSecond?type=get",BASE_URL]
@interface ChongzhiViewController ()<UITextFieldDelegate>
@property (nonatomic,strong)AFHTTPSessionManager* manger;

@end
@implementation ChongzhiViewController
{
    UIImageView * imview; //银行logo
    UILabel * yinhanglabel; //银行label
    UILabel * weihaolabel; //尾号label
    UITextField * chongzhitf; //金额tf
    UIButton * nextbtn; //下一步
    UIView * zhifuview; //支付密码界面
    UITextField * textFieldmima; //密码输入TF
    NSMutableArray * dotArray; //用于放密码黑点的数组
    UIView * mengbanview; //蒙板
    NSString * pstextstring; //密码str
    NSString * card_type;  //01借记卡 02贷记卡
    NSString * bank_id; // 银行卡id
    NSString * bankphonestr; //银行返回的手机号
    
}
- (void)viewWillAppear:(BOOL)animated{
    self.navigationController.navigationBar.hidden = YES;
    self.tabBarController.tabBar.hidden = YES;
    
}
- (void)viewWillDisappear:(BOOL)animated{
    self.navigationController.navigationBar.hidden = NO;
    self.tabBarController.tabBar.hidden = NO;
    
}

- (void)viewDidLoad {
    [super viewDidLoad];
    [self checkBank]; //查询
    [self createUI];
    
    // Do any additional setup after loading the view.
}
#pragma mark  --------- -- - - - - - - 查询当前银行卡－ － －－ － － － － － －
- (void)checkBank{
    
    //请求账号信息，余额等，赋值。。
    UIImageView * ima = [PublicMethod startAnimation];
    
    NSString * token = [[NSUserDefaults standardUserDefaults]objectForKey:USER_TOCKE];
    
    NSString * url = [NSString stringWithFormat:@"%@&token=%@",URL_CHECKBANK,token];
    
    NSLog(@"充值银行卡 url %@",url);
    
    [self.manger GET:url parameters:nil success:^(NSURLSessionDataTask *task, id responseObject) {
        
        if (responseObject) {
            
            NSDictionary * dict = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
            
            NSInteger code = [dict[@"code"]integerValue];
            
            if (code == 0) {
                // 停止动画
                [ima stopAnimating];
                //获得银行卡号，余额，银行名称，logo ID值
                NSDictionary * info = dict[@"info"];
                yinhanglabel.text = info[@"bank_name"];
                weihaolabel.text  = info[@"bank_account"];
                bank_id = info[@"bank_id"];
                card_type = info[@"card_type"];
                bankphonestr  = info[@"telephone"];
                NSLog(@"银行卡 类型 %@,id %@",card_type,bank_id);
                imview.image = [UIImage imageNamed:bank_id];
                
            }else{
                [ima stopAnimating];
                ALERT(@"提示", dict[@"info"], self, @"确定", nil);
            }
        
        }
        
    } failure:^(NSURLSessionDataTask *task, NSError *error) {
        
        ALERT(@"提示", @"网络请求失败", self, @"确定", nil);
        [ima stopAnimating];
        
    }];
}

#pragma mark   -- - - - - - - --  下一步核对密码金额 - - --   － － － － －
- (void)nextBank{
    
    UIImageView * ima = [PublicMethod startAnimation];
    NSString * token = [[NSUserDefaults standardUserDefaults]objectForKey:USER_TOCKE];
    NSString * url = [NSString stringWithFormat:@"%@&token=%@&money=%@&password=%@",URL_NEXT,token,chongzhitf.text,pstextstring];
    NSLog(@"密码 tf %@",pstextstring);
    NSLog(@"下一步 url %@",url);
    
    [self.manger GET:url parameters:nil success:^(NSURLSessionDataTask *task, id responseObject) {
        
        if (responseObject) {
            
            NSDictionary * dict = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
            
            NSInteger code = [dict[@"code"]integerValue];
            
            if (code == 0) {
                // 停止动画
                [ima stopAnimating];
                //验证成功，进入下一页,进入充值确认界面
                QuerenChongzhiViewController * querenvc = [[QuerenChongzhiViewController alloc]init];
                querenvc.jinestring = chongzhitf.text;
                querenvc.bankphonestr = bankphonestr;
                [self.navigationController pushViewController:querenvc animated:YES];
                
            }else{
                
                [ima stopAnimating];
                ALERT(@"提示", dict[@"info"], self, @"确定", nil);
                
            }
            
        }
        
        
    } failure:^(NSURLSessionDataTask *task, NSError *error) {
        
        
        ALERT(@"提示", @"网络请求失败", self, @"确定", nil);
        
        [ima stopAnimating];
        
    }];
}


- (void)createUI{
    
    self.view.backgroundColor = [UIColor whiteColor];
    
    float fontsize = 17;
    
    fontsize = SCREEN_H < 667 ? 15 : 19;
    
    if (SCREEN_H == 667) {
        
        fontsize = 17;
    }
    self.view.backgroundColor = COLORRGBA(239, 239, 239, 1);
    //设置表头
    UIView * titleview = [[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_W, 128.0/1334*SCREEN_H)];
    
    titleview.backgroundColor = COLORRGBA(7, 24, 57, 1);
    
    [self.view addSubview:titleview];
    
    //title
    UILabel * titlelab = [[UILabel alloc]initWithFrame:CGRectMake(0, 20.0, SCREEN_W, 90.0/H_BASE*SCREEN_H)];
    titlelab.text = @"账户充值";
    
    titlelab.textColor = [UIColor whiteColor];
    
    [self.view addSubview:titlelab];
    
    titlelab.textAlignment = NSTextAlignmentCenter;
    
    titlelab.font = [UIFont systemFontOfSize:fontsize];
    
    UILabel * leftlable  = [[UILabel alloc]initWithFrame:CGRectMake(0, 20+14.0/1334*SCREEN_H, 150.0/W_BASE*SCREEN_W, 60.0/1334.0*SCREEN_H)];
    leftlable.textAlignment = NSTextAlignmentCenter;
    NSString * endstr = @"\U0000e697";
    NSString * text = [NSString stringWithFormat:@"%@%@",endstr,@"返回"];
    leftlable.attributedText = [self changeLabelWithText2:text andStartplace:endstr andendplae:nil andfontsize:fontsize-2];
    leftlable.textColor = [UIColor whiteColor];
    [self.view addSubview:leftlable];
    
    UIButton * returnbtn = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 150.0/W_BASE*SCREEN_W, 150.0/H_BASE*SCREEN_H)];
    [returnbtn addTarget:self action:@selector(enterClick:) forControlEvents:UIControlEventTouchUpInside];
    returnbtn.tag = return_tag;
    [self.view addSubview:returnbtn];
    
    UIView * backview = [[UIView alloc]initWithFrame:CGRectMake(0, 127.0/H_BASE*SCREEN_H, SCREEN_W, SCREEN_H-127.0/H_BASE*SCREEN_H)];
    backview.backgroundColor = COLORRGBA(239, 239, 239, 1);
    [self.view addSubview:backview];

    UIView * yinhangview = [[UIView alloc]initWithFrame:CGRectMake(0, CGRectGetMinY(backview.frame)+28.0/H_BASE*SCREEN_H, SCREEN_W, 120.0/H_BASE*SCREEN_H)];
    yinhangview.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:yinhangview];
    
    imview = [[UIImageView alloc]initWithFrame:CGRectMake(24.0/W_BASE*SCREEN_W, 24.0/H_BASE*SCREEN_H, 80.0/W_BASE*SCREEN_W, 80.0/W_BASE*SCREEN_W)];
    imview.backgroundColor = [UIColor whiteColor];
    [self imageCompressWithSimple:imview.image scaledToSize:CGSizeMake(70.0/W_BASE*SCREEN_W, 70.0/W_BASE*SCREEN_W)];
    [yinhangview addSubview:imview];

    yinhanglabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(imview.frame)+18.0/W_BASE*SCREEN_W, CGRectGetMinY(imview.frame), 440.0/W_BASE*SCREEN_W, 44.0/H_BASE*SCREEN_H)];
    yinhanglabel.text = @"中国邮政储蓄银行";
    yinhanglabel.textColor = [UIColor blackColor];
    yinhanglabel.font = [UIFont systemFontOfSize:fontsize];
    [yinhangview addSubview:yinhanglabel];
    
    weihaolabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMinX(yinhanglabel.frame), CGRectGetMaxY(yinhanglabel.frame), 300.0/W_BASE*SCREEN_W, CGRectGetHeight(yinhanglabel.frame))];
    weihaolabel.textColor = COLORRGBA(180, 180, 180, 1);
    weihaolabel.text = @"尾号2444";
    weihaolabel.font = [UIFont systemFontOfSize:fontsize-3];
    [yinhangview addSubview:weihaolabel];
    
    UILabel * jiangelab = [[UILabel alloc]initWithFrame:CGRectMake(24.0/W_BASE*SCREEN_W, CGRectGetMaxY(yinhangview.frame), SCREEN_W - 24.0/W_BASE*SCREEN_W, 78.0/H_BASE*SCREEN_H)];
    jiangelab.backgroundColor = COLORRGBA(239, 239, 239, 1);
    jiangelab.text = @"该次本卡最多充值10.000.00元";
    jiangelab.font = [UIFont systemFontOfSize:fontsize - 4];
    jiangelab.textColor = COLORRGBA(153, 153, 153, 1);
    [self.view addSubview:jiangelab];

    UIView * jineview = [[UIView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(jiangelab.frame), SCREEN_W, 81.0/H_BASE*SCREEN_H)];
    jineview.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:jineview];
    
    UILabel * jine = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMinX(jiangelab.frame), 0, CGRectGetWidth(imview.frame), 81.0/H_BASE*SCREEN_H)];
//    jine.backgroundColor = [UIColor yellowColor];
    [jineview addSubview:jine];
    jine.textColor = [UIColor blackColor];
    jine.text = @"金额";
    jine.font = [UIFont systemFontOfSize:fontsize-3];
    
    chongzhitf = [[UITextField alloc]initWithFrame:CGRectMake(CGRectGetMinX(yinhanglabel.frame), 0, 300.0/W_BASE*SCREEN_W, CGRectGetHeight(jine.frame))];
//    chongzhitf.backgroundColor = [UIColor yellowColor];
    chongzhitf.textColor = [UIColor blackColor];
    [jineview addSubview:chongzhitf];
    chongzhitf.font = [UIFont systemFontOfSize:fontsize -3];
    chongzhitf.placeholder = @"请输入充值金额";
    chongzhitf.keyboardType = UIKeyboardTypeDecimalPad;
    chongzhitf.delegate = self;
//    [chongzhitf becomeFirstResponder];
    
    nextbtn = [[UIButton alloc]initWithFrame:CGRectMake(CGRectGetMinX(jine.frame), CGRectGetMaxY(jineview.frame)+62.0/H_BASE*SCREEN_H, SCREEN_W-CGRectGetMinX(jine.frame)*2, 80.0/H_BASE*SCREEN_H)];
    nextbtn.backgroundColor = COLORRGBA(227, 227, 227, 1);
    nextbtn.layer.cornerRadius = 2;
    nextbtn.clipsToBounds = YES;
    [self.view addSubview:nextbtn];
    nextbtn.titleLabel.font = [UIFont systemFontOfSize:fontsize-2];
    [nextbtn setTitle:@"下一步" forState:UIControlStateNormal];
    [nextbtn setTitleColor:COLORRGBA(204, 204, 204, 1) forState:UIControlStateNormal];
    nextbtn.tag = next_tag;
    [nextbtn addTarget:self action:@selector(enterClick:) forControlEvents:UIControlEventTouchUpInside];
    
    //支付输入密码
    
    mengbanview = [[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_W, 397.0/H_BASE*SCREEN_H)];
    mengbanview.backgroundColor = COLORRGBA(153, 153, 153, 0.4);
    
    zhifuview = [[UIView alloc]initWithFrame:CGRectMake(0, 397.0/H_BASE*SCREEN_H, SCREEN_W, SCREEN_H-397.0/H_BASE*SCREEN_H)];
    zhifuview.backgroundColor = [UIColor whiteColor];
//    [self.view addSubview:zhifuview];
    UIButton * cancelbtn = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 112.0/W_BASE*SCREEN_W, 112.0/W_BASE*SCREEN_W)];
//    cancelbtn.backgroundColor = [UIColor yellowColor];
    [zhifuview addSubview:cancelbtn];
    [cancelbtn setTitle:@"\U0000e69a" forState:UIControlStateNormal];
    cancelbtn.titleLabel.font = [UIFont fontWithName:@"iconfont" size:fontsize];
    cancelbtn.tag = cancel_tag;
    [cancelbtn addTarget:self action:@selector(enterClick:) forControlEvents:UIControlEventTouchUpInside];
    [cancelbtn setTitleColor:COLORRGBA(159, 159, 159, 1) forState:UIControlStateNormal];
    UILabel * zhifulab = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, SCREEN_W, 112.0/W_BASE*SCREEN_W)];
    zhifulab.text = @"请输入支付密码";
    [zhifuview addSubview:zhifulab];
    zhifulab.font = [UIFont systemFontOfSize:fontsize +1];
    zhifulab.textColor = [UIColor blackColor];
    zhifulab.textAlignment = NSTextAlignmentCenter;
    UIView * breakview = [[UIView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(zhifulab.frame), SCREEN_W, 0.5)];
    breakview.backgroundColor = COLORRGBA(204, 204, 204, 1);
    [zhifuview addSubview:breakview];
//    zhifuview.hidden = YES;
    
    textFieldmima = [[UITextField alloc] initWithFrame:CGRectMake(30.0/W_BASE*SCREEN_W, CGRectGetMaxY(breakview.frame)+46.0/H_BASE*SCREEN_H, SCREEN_W - 60.0/W_BASE*SCREEN_W, K_Field_Height)];
    textFieldmima.backgroundColor = [UIColor whiteColor];
    //输入的文字颜色为白色
    textFieldmima.textColor = [UIColor whiteColor];
    //输入框光标的颜色为白色
    textFieldmima.tintColor = [UIColor whiteColor];
    textFieldmima.delegate = self;
    textFieldmima.autocapitalizationType = UITextAutocapitalizationTypeNone;
    textFieldmima.keyboardType = UIKeyboardTypeNumberPad;
    textFieldmima.layer.borderColor = [COLORRGBA(204, 204, 204, 1)CGColor];
    textFieldmima.layer.borderWidth = 1;
    [textFieldmima addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
    [zhifuview addSubview:textFieldmima];
    [self initPwdTextField];//创建密码tf的分割线
    
    UIButton * forgetbtn = [[UIButton alloc]initWithFrame:CGRectMake(SCREEN_W - 137.0/W_BASE*SCREEN_W-26.0/W_BASE*SCREEN_W, CGRectGetMaxY(textFieldmima.frame), 137.0/W_BASE*SCREEN_W, 70.0/H_BASE*SCREEN_H)];
//    forgetbtn.backgroundColor = [UIColor purpleColor];
    forgetbtn.titleLabel.textAlignment = NSTextAlignmentRight;
    forgetbtn.titleLabel.font = [UIFont systemFontOfSize:fontsize-3];
    [forgetbtn setTitle:@"忘记密码?" forState:UIControlStateNormal];
    [forgetbtn setTitleColor:COLORRGBA(47, 165, 255, 1) forState:UIControlStateNormal];
    [zhifuview addSubview:forgetbtn];
    forgetbtn.tag = forget_tag;
    [forgetbtn addTarget:self action:@selector(enterClick:) forControlEvents:UIControlEventTouchUpInside];
    
    
    
}
#pragma mark  - - -- - - - - - 将输入密码的tf分割成点 － － － － － － － － － － －
- (void)initPwdTextField
{
    //每个密码输入框的宽度
    CGFloat width = (SCREEN_W - 32) / kDotCount;
    //生成分割线
    for (int i = 0; i < kDotCount - 1; i++) {
        UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(CGRectGetMinX(textFieldmima.frame) + (i + 1) * width, CGRectGetMinY(textFieldmima.frame), 1, K_Field_Height)];
        lineView.backgroundColor = COLORRGBA(204, 204, 204, 1);
        [zhifuview addSubview:lineView];
    }
    dotArray = [[NSMutableArray alloc] init];
    //生成中间的点
    for (int i = 0; i < kDotCount; i++) {
        UIView *dotView = [[UIView alloc] initWithFrame:CGRectMake(CGRectGetMinX(textFieldmima.frame) + (width - kDotCount) / 2 + i * width, CGRectGetMinY(textFieldmima.frame) + (K_Field_Height - kDotSize.height) / 2, kDotSize.width, kDotSize.height)];
        dotView.backgroundColor = [UIColor blackColor];
        dotView.layer.cornerRadius = kDotSize.width / 2.0f;
        dotView.clipsToBounds = YES;
        dotView.hidden = YES; //先隐藏
        [zhifuview addSubview:dotView];
        //把创建的黑色点加入到数组中
        [dotArray addObject:dotView];
    }
}

#pragma mark  -  -  起始地＋发货人名（终止地＋收货人名）格式化 － － －-- - -  -
-(NSMutableAttributedString*)changeLabelWithText2:(NSString*)needText andStartplace:(NSString *)startplace andendplae:(NSString *)endplace andfontsize:(float)fontsize
{
    NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] initWithString:needText];
    NSInteger startlength = startplace.length;
    //起始格式化
    [attrString addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"iconfont" size:fontsize+2] range:NSMakeRange(0,startlength)];
    //    //尾部格式化
    [attrString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:fontsize] range:NSMakeRange(startlength , needText.length  - startlength)];
    return attrString;
}

- (UIImage*)imageCompressWithSimple:(UIImage*)image scaledToSize:(CGSize)size
{
    UIGraphicsBeginImageContext(size);
    [image drawInRect:CGRectMake(0,0,size.width,size.height)];
    UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return newImage;
}
/**
 *  重置显示的点
 */
- (void)textFieldDidChange:(UITextField *)textField
{
    if (textField == textFieldmima) {
        NSLog(@"%@", textField.text);

        for (UIView *dotView in dotArray) {
            dotView.hidden = YES;
        }
        for (int i = 0; i < textField.text.length; i++) {
            ((UIView *)[dotArray objectAtIndex:i]).hidden = NO;
        }
        if (textField.text.length == kDotCount) {
            NSLog(@"输入完毕");
        }

    }
    
 }

#pragma mark - - - - - - - - - - -  Action - - - - - - - - - - - - -
- (void)enterClick:(UIButton *)btn{
    
    switch (btn.tag) {
        case return_tag:
            //返回
            [self.navigationController popViewControllerAnimated:YES];
            break;
        case next_tag:
            //下一步
        {
            float tixianum = [chongzhitf.text floatValue];
            if (tixianum > 10000.00 ) {
                ALERT(@"提示", @"提现金额不超过10000元", self, @"确定", nil);
                return;
            }

            //显示键盘
            [UIView animateWithDuration:0.5 animations:^{
                [chongzhitf resignFirstResponder];
                [self.view addSubview:mengbanview];
                [self.view addSubview:zhifuview];
                [textFieldmima becomeFirstResponder];
                textFieldmima.keyboardType = UIKeyboardTypeNumberPad;
                [self  initPwdTextField]; //

            }];
           break;
        }
        case cancel_tag:
        {
            //隐藏支付view
            [mengbanview removeFromSuperview];
            [zhifuview removeFromSuperview];
            [self.view endEditing:YES];
            [self  clearUpPassword];//清除密码
            break;
        }
            case forget_tag:
        {
          //
            [mengbanview removeFromSuperview];
            [zhifuview removeFromSuperview];
            [self.view endEditing:YES];
            [self  clearUpPassword];//清除密码
            ZhifuPass1ViewController * zhifuchange = [[ZhifuPass1ViewController alloc]init];
            [self.navigationController pushViewController:zhifuchange animated:YES];
        }
        default:
            break;
            
    }
}
/**
 *  清除密码
 */

- (void)clearUpPassword
{
    textFieldmima.text = @"";
    [self textFieldDidChange:textFieldmima];
}

#pragma mark - - - - - - - - - - Textfield Delegate  - -- - - - - - - -- - - - - -
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField{

    return YES;
}
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{
    //输入1位，下一步按钮变色
    NSString * textstring = [textField.text stringByReplacingCharactersInRange:range withString:string];
    NSLog(@"textstring %@",textstring);
    pstextstring = textstring;
    if (textField == chongzhitf) {
        if (textstring.length >= 1) {
            nextbtn.backgroundColor = COLORRGBA(59, 214, 117, 1);
            [nextbtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
//            zhifuview.hidden = NO;
        }
    }
    else if (textField == textFieldmima){ //输入密码
        
        if([string isEqualToString:@"\n"]) {
            //按回车关闭键盘
            [textField resignFirstResponder];
            return NO;
        } else if(string.length == 0) {
            //判断是不是删除键
            return YES;
        }
        else if(textstring.length >= kDotCount) {
            //输入的字符个数大于6，则无法继续输入，返回NO表示禁止输入
            NSLog(@"输入的字符个数大于6，忽略输入");
            [self.view endEditing:YES];
            //判断密码是否正确，正确则提示校验成功
            [zhifuview removeFromSuperview];
            [mengbanview removeFromSuperview];
            for (int i = 0; i < textField.text.length; i++) {
                ((UIView *)[dotArray objectAtIndex:i]).hidden = YES;
            }
                       [self nextBank]; //提交密码金额信息
            [self clearUpPassword];// 清除密码

            return NO;
        } else {
            return YES;
        }
    
    }
    return YES;
}
#pragma mark - - - - -- - - - 禁止可被复制粘贴 － － － － －－ － － －
- (BOOL)canPerformAction:(SEL)action withSender:(id)sender
{
    return NO;
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField{
    
    [self.view endEditing:YES];
    return YES;
}
#pragma mark - - -- - - - 懒加载 ---- - -- - -

- (AFHTTPSessionManager*)manger{
    
    if (!_manger) {
        
        _manger = [AFHTTPSessionManager manager];
        
        _manger.responseSerializer = [AFHTTPResponseSerializer serializer];
        
        _manger.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/html",@"application/json", nil];
    }
    return _manger;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
